<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php 
	$ci = & get_instance(); 
	$id = $this->input->post('id',0);
	$cat_array = $ci->pre_define_entity->getListCategory();
	$slb_array = array();
	foreach($cat_array as $cat){
		$SPORT = $ci->sport_entity->init('id', $cat->sport_id);
		$slb_array[$cat->id] = $SPORT->getName().' | '.$cat->title;
	}
	
?>
<?php if(!$id): ?>
<form action="<?php echo site_url('admin/dataman/general/add_edit_event_submit');?>" name="add_edit_event_submit" id="add_edit_event_submit" method="post" enctype="multipart/form-data" >
	
	<div class="grid2"><span class="bold">*Category Name:</span></div>
	<div class="grid6">
		<?php echo form_dropdown( 'cat_id',
								$options = $slb_array,
								$selected = array(),
								"id='cat_id'"
							);	?>
	</div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">*Event Name:</span></div>
	<div class="grid6"><input type="text" maxlength="255" id="title" name="title" value="" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="title_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">*Odds:</span></div>
	<div class="grid6"><input type="text" maxlength="25" id="odds" name="odds" value="" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="odds_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php else:?>
<form action="<?php echo site_url('admin/dataman/general/add_edit_event_submit');?>" name="add_edit_event_submit" id="add_edit_event_submit" method="post" enctype="multipart/form-data" >
	<?php 
		$PRE_DEFINE = $ci->pre_define_entity->init('id',$id);
	?>
	
	<div class="grid2"><span class="bold">*Category Name:</span></div>
	<div class="grid6">
		<?php echo form_dropdown( 'cat_id',
								$options = $slb_array,
								$selected = array($PRE_DEFINE->getParentId()),
								"id='cat_id'"
							);	?>
	</div>
	
	<div class="clrboth"></div>	
	
	<div class="grid2"><span class="bold">*Event Name:</span></div>
	<div class="grid6"><input type="text" maxlength="255" id="title" name="title" value="<?php echo $PRE_DEFINE->getTitle();?>" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="title_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">*Odds:</span></div>
	<div class="grid6"><input type="text" maxlength="25" id="odds" name="odds" value="<?php echo $PRE_DEFINE->getOdds();?>" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="odds_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<input type="hidden" name="id" id="id" value="<?php echo $PRE_DEFINE->getId();?>" />
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php endif;?>